package main

import (
    "context"
    "log"

    "google.golang.org/grpc"

    pb "etcd-discovery/proto"
)

const PORT = "9010"

func main() {
    conn, err := grpc.Dial(":"+PORT, grpc.WithInsecure())
    if err != nil {
        log.Fatalf("grpc.Dial err: %v", err)
    }
    defer conn.Close()

    client := pb.NewSv1ServiceClient(conn)
    resp, err := client.Sv1Concat(context.Background(), &pb.Sv1Request{
        Request: "gRPC",
    })
    if err != nil {
        log.Fatalf("client.Search err: %v", err)
    }else{
        log.Printf("resp1: %s", resp.GetResponse())
    }

	resp, err = client.Sv2Concat(context.Background(), &pb.Sv1Request{
        Request: "gRPC",
    })
    if err != nil {
        log.Fatalf("client.Search err: %v", err)
    }else{
        log.Printf("resp2: %s", resp.GetResponse())
    }
    
	resp, err = client.Sv3Concat(context.Background(), &pb.Sv1Request{
        Request: "gRPC",
    })
    if err != nil {
        log.Fatalf("client.Search err: %v", err)
    }else{
        log.Printf("resp3: %s", resp.GetResponse())
    }
   
}